define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Submit,GoPage, $stateParams) {
		
		//查看抽奖
		$scope.onshow_luckydrawdetail = function(){
			GoPage.go_states("luckydrawdetail");
		}

		//接收参数
		$scope.input = new Object();
		$scope.input.id = $stateParams.id;
		$scope.draw_type = 1;//默认是自动抽奖
	  $scope.init_data = function(draw_type) {
		  Submit.connectagency($scope.input.id,draw_type, function(data) {
				$scope.list = data;
			});
		}
	  $scope.init_data($scope.draw_type); //必须在定义之后
	  
		$scope.getDrawType = function(value){//自动
			$scope.draw_type = value;//$scope.draw_type变量主要是判断样式用
			$scope.init_data($scope.draw_type);
		}
			

	  $scope.delete_act = function(id) {
			var i = 0;
			var n = -1;
			for(var o in $scope.list.member){
				if($scope.list.member[o].member_id == id){
					n = i;
					break;
				}
				i++;
			}
			if(n != -1){
				$scope.list.member.splice(n,1);
			}
		}

	}

	controller.$inject = ['$scope', 'Submit','GoPage','$stateParams'];
	
	return app.registerController("submitctrl",controller);
});